package com.sino.wolf.common.helper;

import com.sino.wolf.common.page.PageBean;
import com.sino.wolf.common.page.ResponseResult;

import java.util.List;

public class MessageHelper {

    public static <T> ResponseResult<PageBean> successPage(String msg, List<T> list) {
        PageBean<T> pageBean = new PageBean<T>(list);
        return new ResponseResult<PageBean>(200, msg != null ? msg : "success", pageBean);
    }

    public static ResponseResult<PageBean> failurePage(String msg) {
        return new ResponseResult<PageBean>(501, msg != null ? msg : "failure", null);
    }

    public static <T> ResponseResult<PageBean> successPage(List<T> list) {
        PageBean<T> pageBean = new PageBean<T>(list);
        return new ResponseResult<PageBean>(200,"success", pageBean);
    }

    public static ResponseResult<PageBean> failurePage() {
        return new ResponseResult<PageBean>(501, "failure", null);
    }
}
